package ydzhao.weixin.tuisong.job;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import ydzhao.weixin.tuisong.common.UserCom;
import ydzhao.weixin.tuisong.util.Pusher;


@Component
public class JobWorker {

    @Scheduled(cron = "0 0 8 * * ?")  //每天上午8点执行
//    @Scheduled(cron="0/15 * * * * ?")  //测试专用
    public void goodMorning() throws Exception {
        Pusher.push(UserCom.OPENID_YOU);
        Pusher.push(UserCom.OPENID_ME);
        //延迟到中午12点分推送答案
        Thread.sleep(1000*60*60*4);
        Pusher.pushAnswer(UserCom.OPENID_YOU);
        Pusher.pushAnswer(UserCom.OPENID_ME);
        //更新每天字谜
        Pusher.update();
    }


}
